package response

import "sort"

type Trent struct {
	WenKe int `json:"wen_ke"`
	LiKe  int `json:"li_ke"`
	Year  int `json:"year"`
	Month int `json:"month"`
}

type TrentList []Trent

func (t TrentList) Sort() TrentList {
	sort.Sort(t)
	return t
}
func (t TrentList) Len() int {
	return len(t)
}
func (t TrentList) Swap(i, j int) {
	t[i], t[j] = t[j], t[i]
}
func (t TrentList) Less(i, j int) bool {
	if t[i].Year < t[j].Year {
		return true
	} else if t[i].Year == t[j].Year {
		return t[i].Month < t[j].Month
	} else {
		return false
	}
}

type StatisticResponse struct {
	OrderCount       int       `json:"order_count"`
	OrderPriceSum    float64   `json:"order_price_sum"`
	StudentsTrent    TrentList `json:"students_trent"`
	MonthInvitedNums int       `json:"month_invited_nums"`
	InvitedTotalNums int       `json:"invited_total_nums"`
	InvitedPayedNums int       `json:"invited_payed_nums"`
}
